package app.netant.finishbook.haokanxs;

import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import app.netant.book.base.BaseDetail;
import app.netant.book.base.BaseEntity;
import app.netant.book.base.BasePage;
import cn.lily.com.enviroment.Enviroment;

public class HaokanxsPage extends BasePage {

	public HaokanxsPage(String netSite) {
		super(netSite);
		this.tableKey = "haokanxs";
		this.selectKey = "#main .listlie ul li a";
		this.preHref = "http://www.haokansx.com";
	}

	@Override
	public String buildHref(Element element) {	
		
		String href = element.attr("href");
		href = href.substring(1);
		int idx = href.indexOf("/");
		href = href.substring(idx);
		href = this.preHref + "/book"+ href;
		
		return href;
	}

	@Override
	public BaseEntity buildEntity() {
		return new HaokanxsEntity();
	}

	@Override
	public BaseDetail buildDetail(String href) {
		return new HaokanxsDetail(href);
	}

	@Override
	public void afterEntity(BaseEntity entity, Element element) {
		
	}
	
	public static void main(String[] args) {
		Enviroment.createEnv();
		Enviroment.getEnv().getLogBean().beginLog();
		HaokanxsPage page = new HaokanxsPage("http://www.haokansx.com/all.html");
		page.analyseHref();
	}
	
}
